from typing import List

"""
[1,3,7,5,10,3]
在这个例子失败了

并不是尽可能的多做交易，还是要做动态规划


"""


class Solution:
    def maxProfit(self, prices: List[int], fee: int) -> int:
        dp = len(prices) * [0]
        current_min_value = float("inf")
        res = 0
        for i in range(len(prices)):
            print("i=", i)
            if (value := prices[i] - current_min_value - fee) > 0:
                res += value
                current_min_value = float("inf")
            current_min_value = min(current_min_value, prices[i])
            print("res=", res, current_min_value)
        return res


if __name__ == "__main__":
    res = Solution().maxProfit([1, 3, 2, 8, 8, 9], 2)
    print(res)

